/*
 * @Author: wei_jt@ecidi.com
 * @Date: 2019-11-07 09:36:15
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-12-21 18:56:01
 * @Description: 权限模块接口
 */
import request from '@/utils/request'


/** 删除数据权限 */
export function deleteDataScope(id) {
  return request({
    url: '/sys-system/dataScope',
    method: 'DELETE',
    params: {
      id
    }
  })
}
/** 获取功能权限列表 不分页 */
export function getButtonList(params) {
  return request({
    url: '/sys-system/menu/buttons',
    method: 'get',
    params: params
  })
}

/** 获取数据权限列表 */
export function getDataScopePage(params) {
  return request({
    url: '/sys-system/dataScopes/page',
    method: 'get',
    params: {
      ...params
    },
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/** 新建数据权限 */
export function addDataScope(data) {
  return request({
    url: '/sys-system/dataScope',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/** 更新数据权限 */
export function saveDataScope(data) {
  return request({
    url: '/sys-system/dataScope',
    method: 'PUT',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/** 获取按钮下权限 */
export function getDataScopes(buttonId) {
  return request({
    url: '/sys-system/dataScopes/button',
    method: 'get',
    params: {
      buttonId
    }
  })
}


/** 获取菜单树 */
export function getMenusTree(params) {
  return request({
    url: '/sys-system/menus/tree',
    method: 'get',
    params: params
  })
}

/** 获取数据列表 */
export function getDataScopeList(params) {
  return request({
    url: '/sys-system/dataScopes',
    method: 'get',
    params: params
  })
}

export function getDataScopeTree() {
  return request({
    url: '/sys-system/dataScopeTrees',
    method: 'get'
  })
}

export function getDataScopeTreeById(data) {
  return request({
    url: '/sys-system/dataScopeTree',
    method: 'get',
    params: data
  })
}
export function checkUrl(data) {
  return request({
    url: data,
    method: 'get'
  })
}
